Ext.Loader.setConfig({
			enabled : true
		});
Ext.Loader.setPath({'Ext.ux' : 'extjs/ux','Aolong.comp' : 'alComp'});

var _resourceStore = null;
var _ = function getResource(key) {
	var index = _resourceStore.findExact('key', key);
	//return (index >= 0) ? _resourceStore.getAt(index).get('value') : key;
	if (index >= 0)
	{
		return _resourceStore.getAt(index).get('text');
	}
	else
	{
		Ext.Ajax.request({
		    url: G_SMPACKAGE +'add_I18nResource.action',
		    params: {
		        jsonString: Ext.encode({"key":key,"text":key})
		    }
		});
		return key;
	}
};

Ext.application({
	requires : ['Aolong.comp.TextField','Aolong.comp.ComboBox','Aolong.comp.CheckBox','Aolong.comp.DateTime',
				'archives.controller.MainFrame'],
	name : 'archives',
	controllers : ['MainFrame'],
	launch : function() {

		_resourceStore = Ext.create('Ext.data.Store', {
					fields : [{name : 'key',type : 'string'}, 
							  {name : 'text',type : 'string'}],
					proxy : {
						type : 'ajax',
						url : G_SMPACKAGE + 'findBySession_I18nResource.action',
						reader : {
							type : 'json'
						}
					}
				});
		_resourceStore.on('load', function() {
					Ext.create('Ext.container.Viewport', {
								id : 'frameView',
								layout : 'border',
								items : [Ext.create('archives.view.frame.Header'),
										 Ext.create('archives.view.frame.Menu'),
										 Ext.create('archives.view.frame.Center'),
										 Ext.create('archives.view.frame.Footer')]
							});
				}, this);
		_resourceStore.load();
	}
});